// sku

import request from '@/utils/request'
import type { SaveSku, SkuList } from '@/api/product/sku/type'
enum API {
  SAVESKU_URL = '/admin/product/saveSkuInfo',
  GETSKUIDLIST_URL = '/admin/product/findBySpuId/',
  GETSKUARR_URL = '/admin/product/list/',
  SKULISTING_URL = '/admin/product/onSale/',
  SKUDELIST_URL = '/admin/product/cancelSale/',
  SKUDELETE_URL= '/admin/product/deleteSku/'
}

export const reqSaveSkuInfo = (skuInfo: SaveSku) =>
  request.post<any, any>(API.SAVESKU_URL, skuInfo)

export const reqGetSkuList = (spuId: number) =>
  request.get<any, SkuList>(API.GETSKUIDLIST_URL + spuId)

export const reqGetSkuArr = (page: number, limit: number) =>
  request.get<any, any>(API.GETSKUARR_URL + `${page}/${limit}`)

export const reqListing = (skuId: number) =>
  request.get<any, any>(API.SKULISTING_URL + skuId)

export const reqDelist = (skuId: number) =>
  request.get<any, any>(API.SKUDELIST_URL + skuId)

  export const reqDeleteSku = (skuId: number) =>
  request.delete<any, any>(API.SKUDELETE_URL + skuId)